<template>
  <div class="item">
    <p>{{ item.user + ":" + item.content }}</p>
    <PostItem
      v-for="item in itemData"
      :item="item"
      :key="item.id"
      :Data="Data" />
  </div>
</template>
<script setup>
import { computed } from "vue";
const props = defineProps(["item", "Data"]);
// 数据过滤，让父节点ID与展示项的ID相同时，在本次循环中展示，否则进入下一次循环展示
const itemData = computed(() =>
  props.Data.filter((v) => v.parentId == props.item.id)
);
</script>
<style scoped>
.item {
  padding: 16px;
}
</style>
